package com.xiao.community.service.impl;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiao.group.common.utils.PageUtils;
import com.xiao.group.common.utils.Query;

import com.xiao.community.dao.OrderDao;
import com.xiao.community.entity.OrderEntity;
import com.xiao.community.service.OrderService;


@Service("orderService")
public class OrderServiceImpl extends ServiceImpl<OrderDao, OrderEntity> implements OrderService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<OrderEntity> page = this.page(
                new Query<OrderEntity>().getPage(params),
                new QueryWrapper<OrderEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<OrderEntity> orderlist(Integer pintuanId,Integer ifstart) {
        QueryWrapper<OrderEntity> wrapper = new QueryWrapper<>();
        QueryWrapper<OrderEntity> id = wrapper.eq("pintuan_id", pintuanId).eq("ifstart",ifstart);
        return baseMapper.selectList(id);
    }

    @Override
    public Integer selectByNum(String orderId) {

        return baseMapper.selectByNum(orderId);
    }

    @Override
    public void updateByOrderIfStart(OrderEntity orderEntity) {
        baseMapper.updateByOrderIfStart(orderEntity);
    }

    @Override
    public List<OrderEntity> selectByOrderId(String orderId) {
        QueryWrapper<OrderEntity> wrapper = new QueryWrapper<>();
        QueryWrapper<OrderEntity> id = wrapper.eq("order_id", orderId);
        return baseMapper.selectList(id);
    }


}